/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

@import '../../../public/stylesheets/variables';

.ui-grid-header--subcategories {
    border-color: $table-border-color;

    .ui-grid-header-canvas {
        background-color: #f5f5f5;
    }

    .ui-grid-row:nth-child(even) .ui-grid-cell.cell-total {
        background-color: rgba(102,175,233,.6);
    }

    .ui-grid-row:nth-child(odd) .ui-grid-cell.cell-total {
        background-color: rgba(102,175,233,.3);
    }

    .ui-grid-header-cell-row {
        height: 30px;
    }

    .ui-grid-header-cell {
        // Workaround: Fixed cell header offset in IE11.
        vertical-align: top;

        .ui-grid-cell-contents > span:not(.ui-grid-header-cell-label) {
            right: 3px;
        }
    }

    .ui-grid-header-cell:last-child .ui-grid-column-resizer.right {
        border-color: $table-border-color;
    }

    .ui-grid-header-cell [role="columnheader"] {
        display: flex;

        flex-wrap: wrap;
        align-items: center;
        justify-content: center;

        height: 100%;

        & > div {
            flex: 1 100%;
            height: auto;
        }

        & > div[ui-grid-filter] {
            flex: auto;
        }
    }

    .ui-grid-header-span {
        position: relative;
        border-right: 0;
        background: #f5f5f5;

        .ng-hide + .ui-grid-header-cell-row .ui-grid-header-cell {
            height: 58px;
        }

        .ng-hide + .ui-grid-header-cell-row .ui-grid-cell-contents {
            padding: 5px 5px;
        }

        .ui-grid-column-resizer.right {
            top: -100px;
        }

        .ng-hide + .ui-grid-header-cell-row .ui-grid-column-resizer.right {
            bottom: 0;
        }

        &.ui-grid-header-cell:not(:first-child) {
            left: 0;
            box-shadow: -1px 0px 0 0 #d4d4d4;
        }

        &.ui-grid-header-cell .ui-grid-header-cell .ui-grid-column-resizer.right {
            border-right-width: 0;
        }

        &.ui-grid-header-cell .ui-grid-header-cell:last-child .ui-grid-column-resizer.right {
            // Hide all right borders, and fix cell offset.
            right: -1px;
            border: none;
        }

        &.ui-grid-header-cell [ng-show] .ui-grid-cell-contents {
            text-indent: -20px;
            margin-right: -20px;
        }

        & > div > .ui-grid-cell-contents {
            border-bottom: 1px solid $table-border-color;
        }
    }

    input {
        line-height: 21px;
    }
}

.ui-grid[ui-grid-selection][ui-grid-grouping],
.ui-grid[ui-grid-selection][ui-grid-tree-view] {
    .ui-grid-pinned-container-left {
        .ui-grid-header--subcategories {
            .ui-grid-header-span {
                &.ui-grid-header-cell {
                    box-shadow: none;
                }
            }
        }
    }
}
